package com.fp.m7.client.widget;

import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.ScrollPanel;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.VerticalPanel;

/**
 * Vertical panel for holding some other widgets, and Next / Previous buttons on the bottom.
 * 
 * @author 7
 */
public class ListContainerWithPrevNextButtonsWidget extends Composite {

    private PreviousNextButtonsWidget prevNextBottomPanel;
    private VerticalPanelWithEmptyView verticalPanel;

    public ListContainerWithPrevNextButtonsWidget() {
        ScrollPanel scrollPanel = new ScrollPanel();
        initWidget(scrollPanel);

        verticalPanel = new VerticalPanelWithEmptyView();
        verticalPanel.setSize("100%", "100%");
        prevNextBottomPanel = new PreviousNextButtonsWidget();
        prevNextBottomPanel.setSize("100%", "100%");

        VerticalPanel content = new VerticalPanel();
        content.setSize("100%", "100%");
        content.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
        content.add(new SimplePanel(verticalPanel));
        content.add(new SimplePanel(prevNextBottomPanel));

        scrollPanel.setWidget(content);
    }

    public Button getNextButton() {
        return prevNextBottomPanel.getNextButton();
    }

    public Button getPreviousButton() {
        return prevNextBottomPanel.getPreviousButton();
    }

    public VerticalPanelWithEmptyView getContentPanel() {
        return verticalPanel;
    }

}
